home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group03a.txt
/
000048_icon-group-sender_Wed Mar 26 09:28:28 2003.msg
< prev
next >
Wrap
Internet Message Format
|
2003-12-22
|
3KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id h2QGSS215552
for icon-group-addresses; Wed, 26 Mar 2003 09:28:28 -0700 (MST)
Message-Id: <200303261628.h2QGSS215552@baskerville.CS.Arizona.EDU>
From: voice_of_reason@australia.edu (Quiet Voice)
X-Newsgroups: comp.lang.icon
Subject: Re: newbie questions -- ressurected
Date: 26 Mar 2003 06:20:48 -0800
X-Complaints-To: groups-abuse@google.com
To: icon-group@cs.arizona.edu
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Thank you for this response and to all who have responded directly by
e:mail. The suggestions were all helpful and did solve the problem.
The next level of dilemma: I would like to sort the list.
I've tried various permutations of code using the sort() function. The
errors I get seeme to be related to a type mis-match caused by the
output type of sort().
Example
write(!sort(data,2))
{Where "data" is the external file to which the table of letters and
associated values was previously written}
It has also occurred to me that the sort() function may not be giving
me what I want anyway. As I recall, sort() reduces a table to a list.
So I would be getting simply a list of the sorted value....not a
re-oragnized table of values sorted by the associated key.
Suggestions?
Thank you!
ernobe <ernobe@yahoo.com> wrote in message news:<b5qe69$2anb2l$1@ID-82761.news.dfncis.de>...
> Quiet Voice wrote:
>
> > Greetings:
> >
> > Several years ago, I made a brief foray into trying to teach myself
> > the ICON programming language and develop some text analysis software.
> > After several fits-n-starts, the project sort of died on the vine.
> >
> > I'm back at it again. Now, I'm trying to dig thru past code, remind
> > myself of what it was supposed to do and how...and shake out the
> > kinks.
> >
> > I ran a piece of code this morning and discovered that it results in
> > an infinite loop.....but I can't figure out why.
> >
> > here is the code fragment:
> >
> > while not((line := read(data)) == "") do every
> > write(lettercount[!line] +:= 1)
> >
> > {Note, this is one continuous line in the actual code}
> > "data" is an input text file
> >
> > From some debugging I've done, it seems like it keep reading from the
> > file after it reaches the end...it just loops back to the begining of
> > the file and starts over again. But I don't figure out why.
> >
> > What am I missing?
> >
> According the Icon Language Reference, read( f ) "Produces the next line
> from f, but fails on end of file."
> Therefore, when the read function fails at the end of the data file,
> a new assignment is not made to the line variable, the not function
> succeeds once again, and an infinite loop ensues.